import React, { Component } from 'react'
import { Redirect } from 'react-router-dom'

function isLogin(WarpComponent) {
  return class extends Component {
    render() {
      if (window.localStorage.getItem('isLogin') === 'true') {
        return <WarpComponent {...this.props}></WarpComponent>
      } else {
        return <Redirect to='/login'></Redirect>
      }
    }
  }
}

export default isLogin